Lightwave Lab, Princeton University
Feb 28, 2020
https://github.com/thomaslima/2020-ELE559-workshop-zeropdk
Email: tlima@princeton.edu
Computer-aided layout
Procedural layout
# make_chip.py
FLOORPLAN_SAFE = 50
TECHNOLOGY = TECHNOLOGY.layers # TODO refactor
if __name__ == "__main__":
layout = pya.Layout()
dbu = layout.dbu = 0.001
TOP = layout.create_cell("TOP")
origin = pya.DPoint(0, 0)
ex = pya.DVector(1, 0)
ey = rotate90(ex)
# FLOORPLAN
FX, FY = 7850, 3000 # um
layout_box(TOP, layout.layer(TECHNOLOGY["FloorPlan"]),
origin, origin + FX * ex + FY * ey, ex)
# Placing each experiment
placement_list = {
"FeedbackWeightBank_experiment": (
exp.FeedbackWeightBank_experiment, # PCell class
2792.04000, 328.87000, # position
{"angle_ex": 90, "N": 5}, # parameters
),
# ...
}
# Place all PCells in placement_list and export port locations for routing
for name, (klass, x, y, params) in placement_list.items():
exp_ports[name] = klass(name, params=params).place_cell(
TOP, x * ex + y * ey
)
# ...
# Perform routing using exp_ports dictionary
# ...
# Removing the $$$CONTEXT_INFO$$$ top cell (Foundries don't like it)
save_options = pya.SaveLayoutOptions()
save_options.write_context_info = False
# CMC told us to have maximum cell name length of 60 characters
save_options.gds2_max_cellname_length = 60
layout.write("mpw-chip.gds", save_options)
PCells are the foundation of layouts with more than a couple polygons
Routing elements refer to the connections between devices (drawn in PCells). They could be metal traces, optical waveguides, or I/O elements.
The connection between PCells and routing elements are defined in the concept of Ports. The port must contain information on the type of connection, the dimensions of the routing elemenet (e.g. waveguide width), a human-readable name, and positioning.
You probably all know KLayout, but few people make good use of the scripting documentation:
I helped Matthias to release a klayout package in PyPI. It works in a standalone way and is loaded with the Database and Geometry APIs, but not Application or Qt (yet).
pip install klayout
Currently there are pre-built wheels in the following versions:
| OS | Python Version |
|---|---|
| macOS 10.11+ | 2.7, 3.7 |
| macOS 10.13+ | 3.5, 3.6 |
| linux x64, x32 | 2.7, 3.5, 3.6, 3.6 |
| win32, win64 | 3.5, 3.6, 3.7 |
Note for advanced users: You can attempt to build klayout from source by running python setup.py install on the cloned folder from klayout's github repo.
!pip install klayout
import klayout.db as pya
a = pya.DPoint(1, 2)
b = pya.DVector(0, 1)
a+b
Requirement already satisfied: klayout in /Users/tlima/Envs/zeropdk37/lib/python3.7/site-packages (0.26.0.dev16)
1,3
Our lab relies on klayout's database engine to produce masks for MPW manufacturing. To aid collaboration, we open-sourced a tool called zeropdk.
Many foundries only offer PDKs to commercial software with a steep price tag, but are happy to offer libraries of standard components in the .gds format. ZeroPDK allows you to quickly bootstrap a Photonics PDK without necessarily relying on their partners: great for academic users and students. Also great for pro users.
Zeropdk is available with pip install zeropdk and the source code is released in our github page
zeropdk.tech: helps load a tech layer definition from a lyp file.zeropdk.layout: a library of tools for advanced polygon creation (round polygons, waveguides, etc).zeropdk.pcell: contains standard class definitions of PCells, ports and parameters. The idea is to make it compatible with SiEPIC-Tools and Klayout Macro Editor (eventually)!pip install zeropdk
Requirement already satisfied: zeropdk in /Users/tlima/02GitProjects/layout/zeropdk (19.10b0) Requirement already satisfied: numpy in /Users/tlima/Envs/zeropdk37/lib/python3.7/site-packages (from zeropdk) (1.17.0) Requirement already satisfied: klayout in /Users/tlima/Envs/zeropdk37/lib/python3.7/site-packages (from zeropdk) (0.26.0.dev16) Requirement already satisfied: scipy in /Users/tlima/Envs/zeropdk37/lib/python3.7/site-packages (from zeropdk) (1.3.0)
!ls ../demo | grep .lyp
from zeropdk.tech import Tech
EBeam = Tech.load_from_xml('../demo/EBeam.lyp')
EBeam.layers
EBeam.lyp
{'Si': Si (1/0),
'31_Si_p6nm': '31_Si_p6nm' (31/0),
'Text': Text (10/0),
'Si N': 'Si N' (20/0),
'Si N++': 'Si N++' (24/0),
'SEM': SEM (200/0),
'M1': M1 (41/0),
'12_M2': '12_M2' (12/0),
'13_MLopen': '13_MLopen' (13/0),
'VC': VC (40/0),
'M Heater': 'M Heater' (47/0),
'FloorPlan': FloorPlan (99/0),
'DevRec': DevRec (68/0),
'PinRec': PinRec (1/10),
'FbrTgt': FbrTgt (81/0),
'Errors': Errors (999/0),
'Lumerical': Lumerical (733/0),
'Waveguide': Waveguide (1/0)}
import zeropdk.layout.waveguide_rounding as wav_rounding
wav_rounding.main() # produce some interesting non-Manhattan waveguides
Wrote waveguide_rounding.gds
Contents of waveguide_rounding.gds:
!python ../demo/main_python.py
Wrote to example_mask.gds
# !open example_mask.gds
Open demo/1. Demo - Using SiEPIC cell library.ipynb
Open demo/2. Demo - MZI PCell.ipynb
One goal: enable collaboration reduce dependence on a single designer or specific computer setup.
Powerpoint presentation in person. Might share here later.